﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" Culture="th-TH" uiCulture="th" AutoEventWireup="true" CodeBehind="PS_RoyalItemHistories.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.PS_RoyalItemHistories" %>
<%@ Register src="../Controls/EmployeeTypeCombo.ascx" tagname="EmployeeTypeCombo" tagprefix="uc1" %>
<%@ Register src="../Controls/MasterYear.ascx" tagname="MasterYear" tagprefix="uc2" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc3" %>


<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<asp:Content 
    ID="Content1" 
    runat="server" 
    contentplaceholderid="ContentPlaceHolder1">   
    
    <title>ประวัติการได้รับพระราชทานเครื่องราชอิสริยาภรณ์</title>
<script type="text/javascript" src="../../Scripts/DatePicker.js" >
    </script>
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
        
    <!-- content start -->
    <telerik:RadAjaxManager runat="Server" ID="RadAjaxManager1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="Button1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="PendingOrdersPanel" />
                        <telerik:AjaxUpdatedControl ControlID="ProcessedOrdersPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="cmdAutoAddNew">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="cmdAutoAddNew" />
                        </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="cmdFilter">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTreeView1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1">
        </telerik:RadAjaxLoadingPanel>

    <telerik:RadScriptBlock runat="server" ID="scriptBlock">
        <script type="text/javascript">
            function CollapseSelectTree() {
                    var treeview = $find('<%= RadTreeView1.ClientID %>');
                    var selectedNode = treeview.get_selectedNode();
                    if (selectedNode != null) {
                        selectedNode.collapse();
                    }
                    else {
                        var firstNode = treeview.findNodeByValue("0");
                        firstNode.collapse();
                    }
                }
                function ExpandSelectTree() {
                    var treeview = $find('<%= RadTreeView1.ClientID %>');
                    var selectedNode = treeview.get_selectedNode();
                    if (selectedNode != null) {
                        selectedNode.expand();
                    }
                    else {
                        var firstNode = treeview.findNodeByValue("0");
                        firstNode.expand();
                    }
                }

                function onTextChange(sender)
                {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }
                function openRadWin()
                {          
                    radopen("PS_RoyalItemReceives.aspx","Window2"); 
                }
                function closeRadWindow(sender, args) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();
                }
                
        </script>

    </telerik:RadScriptBlock>
        <table>
        <tr>
        <td colspan = "2">
           <!-- <uc3:user ID="user1" runat="server" /> -->
        </td>
         <td align = "left"> 
         <div class="moduleDivSlim700">
         <div class="moduleDivBottom700">
         <table>
         <tr>
         <td>ปีที่ขอ :</td>
         <td>
          <uc2:MasterYear ID="cbYear" runat="server" />
         </td>
         <td>ประเภทบุคลากร :</td>
         <td> 
         <uc1:EmployeeTypeCombo ID="cbEmployeeType" runat="server" />        
         </td>
         <td>         
         <asp:Button 
            ID="cmdFilter" 
            Text = "กรองข้อมูล"            
            runat="server" onclick="cmdFilter_Click"/>     
         </td>
         </tr>
         </table>
         </div>
         </div>
        </td>

        </tr>
        <tr>
        <td colspan ="3" >
        <div class="moduleDivSlim1000x450">
        <div class="moduleDivBottom1000">
        <asp:Panel Height="420px" runat = "server" ID = "PanelMain"  >
        <table>
        <tr>
        <td class ="tableHeader" colspan ="3">
        <asp:Label ID="Label3" runat="server" Text = "บันทึกประวัติการได้รับพระราชทานเครื่องราชอิสริยาภรณ์" Height="20px" ></asp:Label>
        </td>
        </tr>
        <tr>
        <td valign = "top">
            <asp:Panel runat="server" ID="PendingOrdersPanel" Width = "250px">
                <telerik:RadTreeView ID="RadTreeView1" Runat="server" 
                    CheckBoxes ="true"
                    TriStateCheckBoxes="true" 
                    CheckChildNodes="true"
                    DataFieldID="Id" 
                    DataFieldParentID="Parent_id" 
                    DataTextField="Name" 
                    DataValueField="Id" 
                    OnNodeExpand ="RadTreeView1_NodeExpand">
                </telerik:RadTreeView>
<%--                <asp:RequiredFieldValidator runat="server" 
                    ID="RequiredFieldValidator1" 
                    ControlToValidate="RadTreeView1"
                    ErrorMessage="<span class='validationMsg'>กรุณาเลือกรายชื่อบุคลากร</span>"
                    EnableClientScript="true" />--%></asp:Panel>
         </td>
         <td width = "50px" valign = "top">
            <asp:Button 
                ID="cmdAutoAddNew" 
                Text = "บันทึก"                
                runat="server" 
                onclick="cmdAutoAddNew_Click"/>
         </td>
          <td valign = "top">
            <asp:Panel runat="server" ID="ProcessedOrdersPanel" Width = "680px" Height="380px" ScrollBars ="Auto">
                <telerik:RadGrid 
                            ID="RadGrid1" 
                            runat="server" 
                            AllowAutomaticDeletes="True" 
                            AllowFilteringByColumn="True" 
                            AllowMultiRowEdit="True" 
                            AllowMultiRowSelection="True" 
                            AllowPaging="True" 
                            AllowSorting="True" 
                            AutoGenerateColumns="False" 
                            EnableAJAX="True" 
                            EnableAJAXLoadingTemplate="True" 
                            GridLines="None" 
                            OnItemCommand="RadGrid1_ItemCommand" 
                            Skin="Outlook" 
                            Width="680px">
                            <MasterTableView 
                                AllowMultiColumnSorting="True" 
                                CellSpacing="-1" 
                                ClientDataKeyNames="Sequence" 
                                CommandItemDisplay="Top" 
                                DataKeyNames="Sequence" 
                                InsertItemPageIndexAction="ShowItemOnCurrentPage" 
                                NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                <CommandItemTemplate>
                            <table width="100%">
                                <tr>
                                    <td>
                                        <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False" 
                                            CommandName="InitInsert"                                            
                                            Visible="<%# !RadGrid1.MasterTableView.IsItemInserted && RadGrid1.EditIndexes.Count <= 0 %>">
                                        <img style="border:0px;vertical-align:middle;" alt="" 
                                        src="../Images/Buttons/AddRecord.gif" /> เพิ่มประวัติการได้รับพระราชทานเครื่องราชฯ</asp:LinkButton>
                                        &nbsp;&nbsp;
                                    </td>
                                    
                                </tr>
                            </table>
                        </CommandItemTemplate>
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>
                                
                                <Columns>
                                    <telerik:GridEditCommandColumn 
                                        ButtonType="ImageButton" >
                                        <ItemStyle Width="15px" HorizontalAlign ="Center" />
                                    </telerik:GridEditCommandColumn>
                                    <telerik:GridButtonColumn 
                                        ButtonType="ImageButton" 
                                        CommandName="Delete" 
                                        ConfirmDialogType="RadWindow" 
                                        ConfirmText="ลบข้อมูลที่เลือก?" 
                                        Text="คลิกเพื่อลบรายการ" 
                                        UniqueName="column1">
                                        <ItemStyle Width="15px" HorizontalAlign ="Center" />
                                    </telerik:GridButtonColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="Sequence" 
                                        DataType="System.Int32" 
                                        Display="False" 
                                        HeaderText="Sequence" 
                                        ReadOnly="True" 
                                        UniqueName="Sequence" 
                                        Visible="False">
                                    </telerik:GridBoundColumn>                                    
                                    <telerik:GridBoundColumn 
                                        DataField="RoyalItem.Sequence" 
                                        DataType="System.Int32" 
                                        Display="False" 
                                        HeaderText="RoyalItem.Sequence" 
                                        ReadOnly="True" 
                                        UniqueName="RoyalItem.Sequence" 
                                        Visible="False">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridTemplateColumn
                                        HeaderText = "ชื่อ - นามสกุล"
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter="true" 
                                        CurrentFilterFunction="Contains" 
                                        ShowFilterIcon="False">
                                        <HeaderStyle Width = "150px" />
                                    <ItemTemplate>
                                    <%# Eval("Employee.Person.NamePrefix.Name")%> <%# Eval("Employee.Person.FirstName")%> 
                                        &nbsp;<%#Eval("Employee.Person.LastName")%> 
                                    </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="PosRef" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="เลขที่ตำแหน่ง" 
                                        UniqueName="PosRef">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="PosName" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="ชื่อตำแหน่ง" 
                                        UniqueName="PosName">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="ClassName" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="ระดับตำแหน่ง" 
                                        UniqueName="ClassName">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="JobSiteName" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="สังกัด" 
                                        UniqueName="JobSiteName>
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn Visible="False"
                                        DataField="GazetteNo1" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="เล่มที่ (ราชกิจจานุเบกษา)" 
                                        UniqueName="GazetteNo1">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn Visible="False"
                                        DataField="GazetteNo2" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="ตอนที่ (ราชกิจจานุเบกษา)" 
                                        UniqueName="GazetteNo2">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn Visible="False"
                                        DataField="GazetteNo3" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="หนังสือเล่มที่ (ราชกิจจานุเบกษา)" 
                                        UniqueName="GazetteNo3">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn Visible="False"
                                        DataField="GazetteNo4" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="เลขหน้า (ราชกิจจานุเบกษา)" 
                                        UniqueName="GazetteNo4">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn Visible="False"
                                        DataField="GazetteNo5" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="ลำดับที่ (ราชกิจจานุเบกษา)" 
                                        UniqueName="GazetteNo5">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn Visible="False"
                                        DataField="GazetteDate" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        DataFormatString ="{0:dd/MM/yyyy}"
                                        HeaderText="ราชกิจจาลงวันที่" 
                                        UniqueName="GazetteDate">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                </Columns>
                                <EditFormSettings 
                                    EditFormType="WebUserControl" 
                                    UserControlName="../UserControls/PS_RoyalItemHistories.ascx">
                                    <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                                </EditFormSettings>
                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                            </MasterTableView>
                            <ClientSettings AllowColumnHide="True" 
                                AllowColumnsReorder="True" 
                                EnableRowHoverStyle="True" 
                                ReorderColumnsOnClient="True">
                                <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                                </ClientSettings>
                        </telerik:RadGrid>
                         <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
                        <Windows>
                            <telerik:RadWindow KeepInScreenBounds ="true"
                                id="Window2" 
                                runat="server"
                                showcontentduringload="true"
                                width="660px"
                                height="400px"
                                Modal ="true"
                                title="บันทึกประวัติการได้รับพระราชทานเครื่องราชฯ"
                                ReloadOnShow="true"
                                OnClientClose="closeRadWindow">
                            </telerik:RadWindow>
                        </Windows>
                        </telerik:RadWindowManager>

            </asp:Panel>
            </td>
            </tr>
            </table>
        </asp:Panel>
        </td>
        </div>
        </div>
        </tr>
         </table>
    
    </asp:Content>
